package com.sanyang.pda.ui.manualdelivery;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.sanyang.pda.adapter.ManualDeliveryStatisticsAdapter;
import com.sanyang.pda.bean.DeliveryStatisticsBean;
import com.sanyang.pda.contract.ManualDeliveryStatisticsContract;
import com.sanyang.pda.presenter.ManualDeliveryStatisticsPresenter;
import com.wangshen.base.ui.mvp.base.ui.BaseMvpFragment;
import com.wangshen.projectbase.R;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;


public class DeliveryStatisticsFragment extends BaseMvpFragment<ManualDeliveryStatisticsPresenter> implements  ManualDeliveryStatisticsContract.View {

    @BindView(R.id.rv_list)
    RecyclerView rvList;
    private String entryNo;
    private ManualDeliveryStatisticsAdapter deliveryStatisticsAdapter;
    private ArrayList<DeliveryStatisticsBean> data = new ArrayList<>();

    public DeliveryStatisticsFragment(String entryNo) {
        this.entryNo = entryNo;
    }


    @Override
    public int getViewId() {
        return R.layout.fragment_delivery_statistics;
    }

    @Override
    public void initView() {
        rvList.setLayoutManager(new LinearLayoutManager(mContext));
        deliveryStatisticsAdapter=new ManualDeliveryStatisticsAdapter(R.layout.item_delivery_statistics,new ArrayList<>());
        rvList.setAdapter(deliveryStatisticsAdapter);
    }

    @Override
    public void initLinsenterner() {

    }

    @Override
    public void getData() {
        presenter.countDelivery(entryNo);
    }

    @Override
    public ManualDeliveryStatisticsPresenter getPresenter() {
        return new ManualDeliveryStatisticsPresenter();
    }

    @Override
    public void setList(List<DeliveryStatisticsBean> list) {
        deliveryStatisticsAdapter.setNewInstance(list);
    }
}

